<template>
  <div class="insureEli_conter">
    <div style="text-align:right;margin-top: 10px;margin-right: 30px">
      <el-button type="primary" @click="getBack">返回</el-button>
    </div>
    <el-row class="row_top">
      <el-col :span="18">
        <div class="top_img" style="text-align: center">
          <img src="../../../assets/images/img.png" height="62" width="507"/>
        </div>
      </el-col>
      <el-col :span="6">


      </el-col>
    </el-row>
    <el-row class="el-row">
      <el-col :span="24">
        <div class="title">雇主责任保险（A）投保单 <span>No.</span></div>
      </el-col>

    </el-row>
    <el-row class="el-row">
      <el-col :span="24">
        <div class="explain">欢迎您到中国人寿财产保险股份有限公司投保！请您在投保前务必详细阅读相关保险条款，特别注意<span>责任免除、投保人及被保险人义务、赔偿处理</span>等内容，据实回答保险人就投保事项提出的相关询问，并用蓝色或黑色墨水笔如实填写投保单及附件。投保后相关内容若发生变动，请及时通知保险人。
        </div>
      </el-col>
    </el-row>
    <!--   中间内容添加投保信息-->
    <div class="tem_from">
      <el-form :model="formData" ref="formData" :rules="rules" label-width="120px" style="width: 100%">
        <el-row>
          <el-col :span="4">
            <h3>1. 投保人信息</h3>
            <!--            <div style="margin-left: 20px;"></div>-->
          </el-col>
          <!--          <el-col :span="20">-->
          <!--            <el-form-item label="用工单位" prop="EmployerId" style="margin-top: 20px">-->
          <!--              <el-select v-model="formData.EmployerId" placeholder="请选择用工单位">-->
          <!--                <el-option-->
          <!--                  @click.native="getEmployer(item)"-->
          <!--                  v-for="item in Employer"-->
          <!--                  :key="item.id"-->
          <!--                  :label="item.name"-->
          <!--                  :value="item.id">-->
          <!--                </el-option>-->
          <!--              </el-select>-->
          <!--            </el-form-item>-->
          <!--          </el-col>-->
        </el-row>
        <div class="infor">
          <el-form-item label="投保人" prop="name1">
            <el-input class="el-input" ref="name1" placeholder="请输入投保人" v-model="formData.name1"></el-input>
          </el-form-item>
          <el-form-item label="联系人姓名" prop="contactPerson1">
            <el-input class="el-input" ref="contactPerson1" placeholder="请输入联系人姓名"
                      v-model="formData.contactPerson1"></el-input>
          </el-form-item>
          <el-form-item label="联系电话" prop="phone1">
            <el-input class="el-input" ref="phone1" placeholder="请输入联系方式" v-model="formData.phone1"></el-input>
          </el-form-item>
          <el-form-item label="通讯地址" prop="mailAddress1">
            <el-input class="el-input" ref="mailAddress1" placeholder="请输入通讯地址"
                      v-model="formData.mailAddress1"></el-input>
          </el-form-item>
          <el-form-item label="邮编" prop="emailCode1">
            <el-input class="el-input " ref="emailCode1" placeholder="请输入邮编"
                      v-model="formData.emailCode1"></el-input>
          </el-form-item>
          <el-form-item label="电子邮箱" prop="email1">
            <el-input class="el-input" ref="email1" placeholder="电子邮箱" v-model="formData.email1"></el-input>
          </el-form-item>
        </div>
        <el-row style="display: flex;flex-flow: wrap">
          <h3>2. 被保险人基本信息</h3>
          <!--            <div style="margin-left: 20px;"></div>-->
          <el-form-item label="用工单位" prop="employerId2" style="margin-top: 20px">
            <div
                style="width: 210px;height:40px;line-height: 40px;border: 1px solid #d9d9d9;border-radius: 6px;color: #d9d9d9;padding-left: 5px "
                v-if="Employer.length==0" @click="getEmployers">请添加用工单位
            </div>
            <el-select ref="EmployerId" v-else v-model="formData.employerId2" placeholder="请选择用工单位">
              <el-option
                  @click.native="getEmployer(item)"
                  v-for="item in Employer"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
              </el-option>
            </el-select>
          </el-form-item>
        </el-row>
        <div class="infor" v-if="formData.employerId2!=''">
          <el-form-item :model="formData" label="被保险人" prop="name2">
            <el-input class="el-input" ref="name2" placeholder="请输入被保险人" v-model="formData.name2"></el-input>
          </el-form-item>
          <el-form-item label="联系人姓名" prop="contactPerson2">
            <el-input class="el-input" ref="contactPerson2" placeholder="请输入联系人姓名"
                      v-model="formData.contactPerson2"></el-input>
          </el-form-item>
          <el-form-item label="联系人电话" prop="phone2">
            <el-input class="el-input" ref="phone2" placeholder="请输入联系方式" v-model="formData.phone2"></el-input>
          </el-form-item>
          <el-form-item label="通讯地址" prop="mailAddress2">
            <el-input class="el-input" ref="mailAddress2" placeholder="请输入通讯地址"
                      v-model="formData.mailAddress2"></el-input>
          </el-form-item>
          <el-form-item label="邮编" prop="emailCode2">
            <el-input class="el-input" ref="emailCode2" placeholder="请输入邮编"
                      v-model="formData.emailCode2"></el-input>
          </el-form-item>
          <el-form-item label="电子邮箱" prop="email2">
            <el-input class="el-input" ref="email2" placeholder="电子邮箱" v-model="formData.email2"></el-input>
          </el-form-item>
        </div>

        <div style="margin-left: 20px "><h3>3. 被保险人性质</h3></div>
        <div class="infor1">
          <!--          <el-form-item >-->
          <el-radio-group v-model="formData.nature2">
            <el-radio
                v-for="dict in statusOptions"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>
        </div>
        <div class="infor1_Industry">
          <span>请说明所在行业:</span>
          <el-input style="width: 700px" id="industry" type="textarea" :rows="5" v-model="formData.industry"></el-input>
        </div>
        <div class="infor2 infor3" style="margin-left: 20px">
          <h3>4. 被保险人地址/营业场所:</h3>
          <el-input style="margin-left: 20px;width: 700px" type="textarea" :rows="5"
                    v-model="formData.address2"></el-input>
        </div>
        <div class="infor2 infor3" style="margin-left: 20px">
          <h3>5. 被保险人营业范围:</h3>

          <el-input style="margin-left: 20px;width: 700px" type="textarea" :rows="5"
                    v-model="formData.businessScope2"></el-input>
        </div>
        <div class="infor2 " style="margin-left: 20px;display: flex;flex-flow: wrap">
          <h3 style="margin-right:10px">6. 被保险人工作人员总人数:</h3>
          <el-input class="input" v-model="formData.staffCount2" readonly></el-input>
          <div>人</div>
        </div>
        <el-row class="el-row">
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span>其中高级职员姓名，职务，健康情况，请说明:</span>
              <el-input
                  style="margin-top: 20px;width: 700px"
                  type="textarea"
                  :rows="5"
                  placeholder="请输入内容"
                  v-model="formData.seniorDescription">
              </el-input>
            </div>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span>其他类型工作人员说明（如工作类型、人数、健康情况）:</span>
              <el-input
                  style="margin-top: 20px;width: 700px"
                  type="textarea"
                  :rows="5"
                  placeholder="请输入内容"
                  v-model="formData.generalDescription">
              </el-input>
            </div>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="7">
            <div class="grid-content bg-purple"> 注：如必要，请附工作人员基本情况清单。</div>
          </el-col>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap;align-items: center">
          <div class="grid-content1" style="margin-right: 20px;"><h3>7. 过去三年是否投保过与雇主责任相关的保险？</h3></div>
          <el-radio-group v-model="formData.isELI" style="margin-top: 5px;">
            <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

          <div class="grid-content" style="margin: 0 20px;">过去三年损失情况如何？</div>
          <!---->
          <el-radio-group v-model="formData.isLossEli" style="margin-top: 5px;">
            <el-radio
                v-for="dict in statusOptions2"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-row>

        <div v-if="formData.isELI=='1' || formData.isLossEli=='1'">
          <el-row>
            <el-col :span="5">
              <div class="grid-content">如果有，请说明:</div>
            </el-col>
            <el-col :span="4">
              <div>
                保险期间
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                保险人数
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                损失情况
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                获赔情况
              </div>
            </el-col>
          </el-row>
          <!--        <el-row>-->
          <div style="margin: 0 20px 20px 40px">
            <el-input
                style="width: 700px"
                class="input1"
                type="textarea"
                :rows="5"
                placeholder="请输入内容"
                v-model="formData.eliDesc">
            </el-input>
          </div>
        </div>
        <el-row style="display: flex;flex-flow: wrap">
          <div class="grid-content1" style="margin-right: 20px"><h3>8. 是否按照《工伤保险条例》参加工伤保险？</h3></div>

          <el-radio-group v-model="formData.isII">
            <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-row>
        <div v-if="formData.isII=='1'">
          <el-row>
            <el-col :span="7">
              <div class="grid-content">如果是，过去三年被保险人参加工伤保险的情况:</div>
            </el-col>
            <el-col :span="4">
              <div>
                保险期间
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                保险人数
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                损失情况
              </div>
            </el-col>
            <el-col :span="4">
              <div>
                获赔情况
              </div>
            </el-col>
          </el-row>
          <div style="margin: 0 20px 20px 40px">
            <el-input
                class="input1"
                style="width: 700px"
                type="textarea"
                :rows="5"
                placeholder="请输入内容"
                v-model="formData.iiDesc">
            </el-input>
          </div>
        </div>

        <el-row style="display: flex;flex-flow: wrap">

          <div class="grid-content1" style="margin-right: 20px"><h3>9. 工作人员上岗前，是否经过岗位培训？</h3></div>

          <el-radio-group v-model="formData.isTrain">
            <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-row>
        <el-row style="display: flex;flex-flow: wrap" v-if="formData.isTrain=='1'">

          <div class="grid-content"> 培训时间一般多长？</div>
          <el-input
              placeholder="请输入培训时间"
              v-model="formData.trainingTime"
              clearable
              style="width: 250px;margin-left: 20px">
          </el-input>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">

          <div class="grid-content1" style="margin-right: 20px"><h3>10. 是否拥有专职医疗人员？</h3></div>

          <el-radio-group v-model="formData.isHaveMedicalStaff">
            <el-radio
                v-for="dict in statusOptions2"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-row>
        <el-row style="display: flex;flex-flow: wrap" v-if="formData.isHaveMedicalStaff=='1'">
          <div class="grid-content"> 如果有，请列明数量:</div>
          <el-input
              placeholder="请输入数量"
              v-model="formData.medicalStaffCount"
              clearable
              style="width: 250px"
          >
          </el-input>

        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
          <div class="grid-content1" style="margin-right: 20px"><h3>11.与最近的医院的距离:</h3></div>
          <el-input
              placeholder="请输入距离"
              v-model="formData.hospitalDistance"
              clearable
              style="width: 250px"
          >
          </el-input>
          <div class="grid-content" style="margin: 0 20px">请提供医院名称:</div>
          <el-input
              placeholder="请输入医院名称"
              v-model="formData.hospitalName"
              clearable
              style="width: 250px"
          >
          </el-input>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">

          <div class="grid-content1" style="margin-right: 20px"><h3>12.是否全部工作人员参加医疗保险？</h3></div>

          <el-radio-group v-model="formData.isJoinMi">
            <el-radio
                v-for="dict in statusOptions1"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-row>
        <el-row v-if="formData.isJoinMi=='1'">
          <el-col :span="24">
            <div class="grid-content" style="display: flex;flex-direction: column">
              <span>如果否，请说明情:</span>
              <el-input
                  style="margin-top: 20px;width: 700px"
                  type="textarea"
                  :rows="5"
                  placeholder="请输入说明情况"
                  v-model="formData.descriptionMi"
                  clearable>
              </el-input>
            </div>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content1" style="padding-right: 20px;display: flex;flex-direction: column">
              <h3>13. 劳动合同中对被保险人工作人员伤、残或死亡及职业性疾病等规定的赔偿原则及限额:</h3>
              <el-input
                  style="margin-top: 20px;margin-left: 20px;width: 700px"
                  type="textarea"
                  :rows="5"
                  placeholder="请输入赔偿原则以及限额"
                  v-model="formData.compPrincipleAndLimit"
                  clearable>
              </el-input>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">经保险人要求，被保险人应将与工作人员签订的劳动合同复印件交由保险人存档。</div>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content1" style="padding-right: 20px;display: flex;flex-direction: column">
              <h3>14.其他需要特别说明的情况:</h3>
              <el-input
                  style="margin-top: 20px;margin-left: 20px;width: 700px"
                  type="textarea"
                  :rows="5"
                  placeholder="请输入赔偿原则以及限额"
                  v-model="formData.otherDescription"
                  clearable>
              </el-input>
            </div>
          </el-col>

        </el-row>

        <el-row>
          <el-col :span="24">
            <div class="grid-content2">以下为投保信息</div>
          </el-col>
        </el-row>
        <el-row style="display: flex;flex-flow: wrap">
          <div class="grid-content1"><h3>15.</h3></div>
<!--                      <el-form-item label="产品方案" class="el-error"  prop="productDataId1" style="margin-top: 20px">-->

<!--                        <div style="width: 210px;height:40px;line-height: 40px;border: 1px solid #d9d9d9;border-radius: 6px;color: #d9d9d9;padding-left: 5px " v-if="productOptions.length==0" @click="handleChanges">请添加用工单位</div>-->
<!--                        <el-cascader  v-else id="input" :options="productOptions"   v-model="formData.productDataId1"  placeholder="请选择产品方案"  @change="handleChange"  :props="props"  ></el-cascader>-->
<!--                      </el-form-item>-->
        </el-row>
<!--        v-if="proShow || productOptions.length==0"-->
       <div >
        <div style="margin-bottom: 40px" v-for="(item,index) in ProductPlan">
          <div style="margin: 10px 20px;font-weight: bold">{{ item.name }}</div>
          <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 1 ) 每人伤亡责任限额（小写）
            </div>
            <el-input
                placeholder="请输入伤亡责任限额（小写）"
                v-model="item.casualties"
                @input="perProfit" readonly style="width: 250px">
            </el-input>
            <div style="margin-left: 10px">元</div>
            <div class="grid-content" style="font-weight: bold;margin:0 20px ">（大写）</div>
            <el-input
                placeholder="显示伤亡责任限额（大写）"
                v-model="item.casualties_s"
                clearable readonly
                style="width: 250px"
            >
            </el-input>
          </el-row>
          <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 2 ) 每人医疗费用责任限额（小写）
            </div>
            <el-input
                placeholder="请输入医疗费用责任限额（小写）"
                v-model="item.medical"
                @input="perProfit1" readonly style="width: 250px">
            </el-input>
            <div style="margin-left: 10px">元</div>
            <div class="grid-content" style="font-weight: bold;margin:0 20px">（大写）</div>
            <el-input
                placeholder="显示医疗费用责任限额（大写）"
                v-model="item.medical_s"
                readonly style="width: 250px">
            </el-input>
          </el-row>

          <el-row style="display: flex;flex-flow: wrap">

            <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 3 )累计责任限额（小写）</div>

            <el-input
                placeholder="请输入累计责任限额（小写）"
                v-model="item.liability"
                @input="perProfit3" readonly style="width: 250px">
            </el-input>
            <div style="margin-left: 10px">元</div>
            <div class="grid-content" style="font-weight: bold;margin: 0 20px">（大写）</div>
            <el-input
                placeholder="显示累计责任限额（大写）"
                v-model="item.liability_s"
                readonly style="width: 250px">
            </el-input>
          </el-row>
          <el-row style="display: flex;flex-flow: wrap">

            <div class="grid-content" style="font-weight: bold;margin-right: 20px;width: 320px;">( 4 )
              每次事故每人医疗费用免赔额（小写）
            </div>

            <el-input
                placeholder="请输入医疗费用免赔额（小写）"
                v-model="item.deductibles"
                @input="perProfit4" readonly style="width: 250px">
            </el-input>

            <div style="margin-left: 10px">元</div>

            <div class="grid-content" style="font-weight: bold;margin: 0 20px">（大写）</div>

            <el-input
                placeholder="显示医疗费用免赔额（大写）"
                v-model="item.deductibles_s"
                readonly style="width: 250px">
            </el-input>

          </el-row>
          <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content" style="font-weight: bold;margin-right: 20px">(5) 保险费率</div>
            <el-input
                placeholder="请输入保险费率"
                v-model="item.insurance_rate"
                readonly
                style="width: 250px"
            >
            </el-input>
            <div class="grid-content"> ‰</div>

          </el-row>
          <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content" style="font-weight: bold;margin-right: 20px">(6) 误工费限额</div>
            <div>100元/天 , 免赔三天</div>
          </el-row>
          <el-row style="display: flex;flex-flow: wrap">
            <div class="grid-content" style="font-weight: bold;margin-right: 20px">(7) 住院津贴限额:</div>
            <div>60元/天 , 免赔三天</div>
          </el-row>
        </div>
        <div style="font-weight: bold;margin-left: 40px">注: 可根据工作人员类型确定差别责任限额。</div>
    </div>
    <el-row style="display: flex;flex-flow: wrap">

      <div class="grid-content1" style="margin-right: 20px"><h3>16.保险期间</h3></div>

<!--      <div style="display: flex;align-items: center;flex-flow: wrap">-->
<!--        {{ insuranceTimeStart1 }} 零时起 {{ insuranceTimeEnd1 }} 二十四时止-->
<!--      </div>-->
      <div style="display: flex;align-items: center;flex-flow: wrap;">

       <span style="margin-right: 10px;">
             <el-form-item  label="起始日期" prop="insuranceTimeStart" style="margin-bottom: 1px">
           <el-date-picker
               ref="insuranceTimeStart"
               v-model="formData.insuranceTimeStart"
               type="date"
               placeholder="请选择起始日期"
               format="yyyy 年 MM 月 dd 日"
               value-format="yyyy-MM-dd">
        </el-date-picker>
          </el-form-item>
        </span> 零时起
       <span style="margin: 0 10px">
         <el-form-item  label="结束日期" prop="insuranceTimeEnd" style="margin-bottom: 1px">
          <el-date-picker
              ref="insuranceTimeEnd"
              v-model="formData.insuranceTimeEnd"
              type="date"
              placeholder="请选择结束日期"  format="yyyy 年 MM 月 dd 日"
              value-format="yyyy-MM-dd">

            </el-date-picker>
           </el-form-item>
       </span> 二十四时止
            </div>
            </el-row>
            <el-row style="display: flex;flex-flow: wrap">

              <div class="grid-content1" style="display: flex;align-items: center;margin-right: 20px"><h3>17. 总保险费</h3>（小写）
              </div>


              <el-input
                  placeholder="请输入总保险费（小写）"
                  v-model="formData.sinsuranceFeeCount"
                  @input="perProfit5" readonly style="width: 250px">
              </el-input>

              <div style="margin-left: 10px">元</div>
              <div class="grid-content">（大写）</div>
              <el-input
                  placeholder="显示总保险费（大写）"
                  v-model="formData.sinsuranceFeeCounts"
                  readonly style="width: 250px">
              </el-input>

            </el-row>
            <el-row style="display: flex;flex-flow: wrap">

              <div class="grid-content1" style="margin-right: 20px"><h3>18. 保险费支付日期:</h3></div>

              <el-date-picker
                  v-model="formData.payTime"
                  type="date"
                  placeholder="请选择支付日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="yyyy-MM-dd">
              </el-date-picker>

            </el-row>
            <el-row style="display: flex;flex-flow: wrap">

              <div class="grid-content1" style="margin-right: 20px"><h3>19. 保险合同争议解决方式选择:</h3></div>

              <el-radio-group v-model="formData.solution">
                <el-radio
                    v-for="dict in statusOptions3"
                    :key="dict.dictValue"
                    :label="dict.dictValue"
                >{{ dict.dictLabel }}
                </el-radio>

              </el-radio-group>


            </el-row>
            <!--        特别约定1-->
    <div>
      <div class="conter">
        <el-row>
          <el-col :span="2">
            <h3>20.特别约定</h3>
          </el-col>
<!--          <el-col :span="22">-->
<!--            <div class="grid-content " style="display: flex;align-items: center">-->
<!--              <span style="color: red;">*</span><span> 投保类型:</span>-->
<!--              <div-->
<!--                  style="width:210px;height:40px;line-height: 40px; text-align: left;font-size: 15px;border: 1px solid #d9d9d9;border-radius: 6px;color: #d9d9d9;padding-left: 5px "-->
<!--                  v-if="options.length==0" @click="gettemplate">请先去添加投保类型-->
<!--              </div>-->
<!--              <el-select v-else v-model="templateName" placeholder="请选择" multiple-->
<!--              >-->

<!--                <el-option-->
<!--                    v-for="(item,index) in options"-->
<!--                    :key="item.id"-->
<!--                    :label="item.name"-->
<!--                    :value="item.id"-->

<!--                    @click.native="getSelect(item,index)"-->
<!--                >-->
<!--                </el-option>-->
<!--              </el-select>-->

<!--            </div>-->
<!--          </el-col>-->
        </el-row>
        <div v-for="(item,index) in ProductPlan" :key="index">

          <div style="margin-bottom: 50px">
            <div style="font-weight: bold;margin-left: 20px;margin-bottom: 20px">{{ item.name }}</div>
            <div style="margin-left: 20px;">
              {{item.specifically_agreed}}
            </div>

        </div>

      </div>
    </div>

      <el-row>
        <el-col :span="24">
          <div class="grid-content ">
            <span style="font-weight: bold;margin-left: 30px">投保人声明:</span>
            保险人已将《雇主责任保险条款》（包括责任免除部分）向本人做了明确说明，本人已充分理解；上述所填写的内容均属实，同意以此投保单及附件作为订立保险合同的依据。
          </div>
        </el-col>
      </el-row>
      <el-row>

        <el-col :span="19">
          <div class="grid-content " style="text-align: right ;margin-right: 5px">
            投保人（签章）:
          </div>
        </el-col>
        <el-col :span="4">
          <div>
            <el-image
                v-if="formData.seal!=null"
                style="width:100px; height: 100px"
                :src="url+formData.seal"
                :preview-src-list="[url+formData.seal]">
            </el-image>
          </div>

        </el-col>
      </el-row>
      <el-row>

        <el-col :span="19">
          <div class="grid-content " style="text-align: right ;margin-right: 5px">
            日期:
          </div>
        </el-col>
        <el-col :span="5">
          <el-date-picker
              v-model="formData.signingTime"
              type="date"
              placeholder="选择日期"
              format="yyyy 年 MM 月 dd 日"
              value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="2">
          <div class="grid-content ">
            承保性质:
          </div>
        </el-col>
        <el-col :span="13">
          <el-radio-group v-model="formData.underwriting">
            <el-radio
                v-for="dict in statusOptions4"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>

        </el-col>
        <el-col :span="4">
          <div class="grid-content " style="text-align: right;">
            业务员/代理人姓名：
          </div>
        </el-col>
        <el-col :span="4">
          <el-input style="width: 220px" v-model="formData.agent" placeholder="请输入业务员/代理人姓名"></el-input>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="2">
          <div class="grid-content ">
            公司网址
          </div>
        </el-col>
        <el-col :span="6">
          <a style="color: dodgerblue">www.chinalife-p.com.cn</a>
        </el-col>
        <el-col :span="4">
          <div> 服务电话：95519</div>
        </el-col>

      </el-row>
      <div>
        <el-row>
          <el-col :span="24">
            <div class="grid-content " style="text-align: center">
              <img src="../../../assets/images/Application.png" height="88" width="690"/></div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <h2 class="grid-content " style="text-align: center">
              免责条款特别提示
            </h2>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div>尊敬的客户：</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="margin-left: 60px">非常感谢您向我们投保 <span
                style="font-weight: bold;text-decoration:underline">雇主责任保险</span>，请仔细阅读保险条款，特别是以下责任免除条款，我们现向您作明确说明，请您认真听取并予以足够的重视：
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">下列原因造成的损失、费用和责任，保险人不负责赔偿:</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（一）投保人、被保险人及其代表的故意行为;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（二）战争、敌对行动、军事行为、武装冲突、罢工、骚乱、暴动、恐怖活动;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（三）核辐射、核爆炸、核污染及其他放射性污染;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（四）大气污染、土地污染、水污染及其他各种污染;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（五）行政行为或司法行为;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（六）被保险人的工作人员犯罪或者违反法律、法规的;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（七）被保险人的工作人员醉酒导致伤亡的;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（八）被保险人的工作人员自残或者自杀的;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">
              （九）在工作时间和工作岗位，被保险人的工作人员因投保时已患有的疾病发作或分娩、流产导致死亡或者在48小时之内经抢救无效死亡。
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">下列损失、费用和责任，保险人不负责赔偿:</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（一）被保险人的承包商工作人员的人身伤亡;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（二）被保险人应该承担的合同责任，但无合同存在时仍然应由被保险人承担的经济赔偿责任不在此限;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（三）罚款、罚金及惩罚性赔款;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（四）精神损害赔偿;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（五）间接损失;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（六）被保险人的工作人员因保险合同列明情形之外原因发生的医疗费用;</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">（七）本保险合同中载明的免赔额。</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold">其他不属于本保险责任范围内的损失、费用和责任，保险人不负责赔偿。</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div style="text-align: center"><h3>中国人寿财产保险股份有限公司宁波市分公司</h3></div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="font-weight: bold"> 投保人声明：</div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content" style="text-indent: 2em">
              本人已收到并仔细阅读了贵公司提供的全部投保的保险条款。本人确认：贵公司已依法对保险合同的内容向本人作出说明；特别是保险合同中的免除保险人责任的条款，贵公司已依法向本人作出明确说明，并向本人进行了多次的提示，本人对保险条款中的保险责任、免除保险人责任的条款的概念、内容及法律后果均已充分理解并明了。特此声明！
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="19">
            <div class="grid-content" style="text-align: right;margin-right: 10px"> 投保人签章/签名:</div>
          </el-col>
          <el-col :span="4">
            <div>
              <el-image
                  v-if="formData.signPolicyholder!=null"
                  style="width:100px; height: 100px"
                  :src="url+formData.signPolicyholder"
                  :preview-src-list="[url+formData.signPolicyholder]">
              </el-image>
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="19">
            <div class="grid-content" style="text-align: right;margin-right: 10px">日期:</div>
          </el-col>
          <el-col :span="4">
            <el-date-picker
                v-model="formData.signPolicyholderTime"
                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd">
            </el-date-picker>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div style="text-align: right">
              <!--                  <el-button type="primary" style="width: 150px" @click="resetForm('formData')">重置</el-button>-->
              <el-button type="primary" style="width: 150px" @click="getAdd('formData')">下一步</el-button>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
    </el-form>
    <div class="footer">
      <el-button type="primary" v-show="gotop" icon="el-icon-top" circle @click="toTop"></el-button>
    </div>
  </div>
  <div>
    <!--      阴影遮罩层-->
    <!--      <el-dialog :visible.sync="outerVisible">-->
    <!--        <vue-esign id='canvas' ref="esign" :width='1000' :height="500" style="border: 1px dashed #c2c1c1;"-->
    <!--                   :isCrop="isCrop" :lineWidth="lineWidth" :lineColor="lineColor" :bgColor.sync="bgColor"/>-->
    <!--        <el-row>-->
    <!--          <el-col :span="24">-->
    <!--            <div style="text-align: center;margin-top: 10px">-->
    <!--              <el-button style="width: 120px" type="primary" @click="handleReset">重置</el-button>-->
    <!--              <el-button style="width: 120px" type="primary" @click="handleGenerate">提交</el-button>-->
    <!--            </div>-->
    <!--          </el-col>-->
    <!--        </el-row>-->
    <!--      </el-dialog>-->
    <!--      <el-dialog :visible.sync="outerVisible1">-->
    <!--        <vue-esign id='canvas1' ref="esign1" :width='1000' :height="500" style="border: 1px dashed #c2c1c1;"-->
    <!--                   :isCrop="isCrop1" :lineWidth="lineWidth1" :lineColor="lineColor1" :bgColor.sync="bgColor1"/>-->
    <!--        <el-row>-->
    <!--          <el-col :span="24">-->
    <!--            <div style="text-align: center;margin-top: 10px">-->
    <!--              <el-button style="width: 120px" type="primary" @click="handleReset1">重置</el-button>-->
    <!--              <el-button style="width: 120px" type="primary" @click="handleGenerate1">提交</el-button>-->
    <!--            </div>-->
    <!--          </el-col>-->
    <!--        </el-row>-->
    <!--      </el-dialog>-->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules1" label-width="150px">
        <el-form-item label="名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入名称"/>
        </el-form-item>
        <el-form-item label="联系人" prop="contact">
          <el-input v-model="form.contact" placeholder="请输入联系人"/>
        </el-form-item>
        <el-form-item label="电话" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入电话"/>
        </el-form-item>
        <el-form-item label="通讯地址" prop="mailAddress">
          <el-input v-model="form.mailAddress" placeholder="请输入通讯地址"/>
        </el-form-item>
        <el-form-item label="邮编" prop="emailCode">
          <el-input v-model="form.emailCode" placeholder="请输入邮编"/>
        </el-form-item>
        <el-form-item label="邮箱号码" prop="email">
          <el-input v-model="form.email" placeholder="请输入邮箱号码"/>
        </el-form-item>
        <el-form-item label="保险人地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入保险人地址"/>
        </el-form-item>
        <el-form-item label="保险人营业范围" prop="businessScope">
          <el-input v-model="form.businessScope" placeholder="请输入保险人营业范围址"/>
        </el-form-item>
        <el-form-item label="所在行业" prop="industry">
          <el-input v-model="form.industry" placeholder="请输入所在行业"/>
        </el-form-item>
        <el-form-item label="保险人性质" prop="nature">
          <el-radio-group v-model="form.nature">
            <el-radio
                v-for="dict in statusOptions"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <!--          <el-form-item label="保险员工总数" prop="staffCount">-->
        <!--            <el-input v-model="form.staffCount" placeholder="请输入保险员工总数" />-->
        <!--          </el-form-item>-->
        <el-form-item label="高级职员姓名，职务，健康情况说明" prop="seniorDescription">
          <el-input type="textarea"
                    :rows="5" v-model="form.seniorDescription" placeholder="请输入高级职员姓名，职务，健康情况说明"/>
        </el-form-item>
        <el-form-item label="普通职员姓名，职务，健康情况说明" prop="generalDescription">
          <el-input type="textarea"
                    :rows="5" v-model="form.generalDescription" placeholder="请输入职务，健康情况说明"/>
        </el-form-item>
        <el-form-item label="用户类型" prop="type">
          <el-radio-group v-model="form.type">
            <el-radio
                v-for="dict in typeOptions2"
                :key="dict.dictValue"
                :label="dict.dictValue"
            >{{ dict.dictLabel }}
            </el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
  </div>
</template>

<script>
import {listTemplate, uploadTmage} from '@/api/base/template'
import {dataURLtoFile} from '@/utils/env'
import {addInsureEli,addInsureEli1} from '@/api/insurance/insureEli'
import {addEmployer, listEmployer, updateEmployer} from '@/api/insurance/employer'
import {batchSave} from "@/api/insurance/user";
import {getUserProfile} from "@/api/system/user";
import {listProductType} from "@/api/insurance/productType";

export default {
  name: "add",
  data() {
    return {
      gotop: false,//回到顶部显示不显示
      proShow: false,//选择产品方案展示保险金额
      url: process.env.VUE_APP_BASE_API,//地址
      open: false,//添加用工单位
      title: '',//添加用工单位标题
      //联系人电话
      contact: '',
      isActive: 1,
      isActive1: 0,
      isActive2: 0,
      isActive3: 0,
      //投保人签字展示显示隐藏
      show: true,
      show1: true,
      isCrop: false,
      //遮罩层显示隐藏
      outerVisible: false,
      lineColor: '#000000',
      bgColor: '',
      lineWidth: 6,
      isCrop1: false,
      //遮罩层显示隐藏
      outerVisible1: false,
      lineColor1: '#000000',
      bgColor1: '',
      lineWidth1: 6,
      options: [],
      //投保性质
      statusOptions: [],
      statusOptions1: [],//7. 过去三年是否投保过与雇主责任相关的保险？
      statusOptions2: [],//7.  //过去三年损失情况如何
      statusOptions3: [],//保险合同争议解决方式选择
      statusOptions4: [],//投保性质
      value: '',
      value1: '',
      //产品方案：
      product: [],
      //投保选择
      list: [],
      templateName: [],//投保类型名称
      formData: {
        customer_id:'',//用户id
        user_id:'',//操作人id
        // productDataId1: '',
        // productDataId: '',//产品方案id
        // templateId: [],//投保类型id
        employerId1: '',//投保用工单位id
        employerId2: '',//被投保用工单位
        name1: '', //  投保人姓名
        contactPerson1: '',//投保人联系人姓名
        phone1: '',  // 投保人联系电话
        mailAddress1: '', //投保人通讯地址
        emailCode1: '',//投保人邮编
        email1: '', //  投保人电子邮箱
        name2: '', //被投保人名称
        contactPerson2: '',//被投保人联系姓名
        phone2: '', //  被投保联系方式
        mailAddress2: '', //投保人通讯地址
        emailCode2: '',//投保人邮编
        email2: '',//  被投保电子邮箱
        nature2: '', //  3被投保人性质
        industry: '',  //  所在行业
        address2: '',  //  被保险人地址/营业场所
        businessScope2: '',  // 被保险人营业范围
        staffCount2: '',  // 被保险人工作人员总人数
        seniorDescription: '', //   其中高级职员姓名，职务，健康情况，请说明：
        generalDescription: '', // 其他类型工作人员说明（如工作类型、人数、健康情况）
        // 7. 过去三年是否投保过与雇主责任相关的保险？ {{isELI1}}是     {{isELI0}}否
        isELI: '0',//是
        //过去三年损失情况如何  {{isLossEli1}}有    {{isLossEli0}}无
        isLossEli: '0',//有
        // 如果有，请说明：保险期间        保险人数                损失情况                获赔情况
        eliDesc: '',
        // 是否按照《工伤保险条例》参加工伤保险？    {{isII1}}是    {{isII0}}否
        isII: '0',//是
        // 如果是，过去三年被保险人参加工伤保险的情况：保险期间  保险人数  损失情况  获赔情况
        iiDesc: '',
        // 工作人员上岗前，是否经过岗位培训？    {{isTrain1}}是    {{isTrain0}}否
        isTrain: '0',//是
        trainingTime: '',    // 培训时间一般多长？
        // 是否拥有专职医疗人员？  {{isHaveMedicalStaff1}}有 {{isHaveMedicalStaff0}}无
        isHaveMedicalStaff: '0',//有
        medicalStaffCount: '', // 如果有，请列明数量
        hospitalDistance: '',    //      与最近的医院的距离
        hospitalName: '', //请提供医院名称
        // 是否全部工作人员参加医疗保险？       {{isJoinMi1}}是   {{isJoinMi0}}否
        isJoinMi: '0',
        descriptionMi: '',// 如果否，请说明情况：
        compPrincipleAndLimit: '', //13. 赔偿原则及限额
        otherDescription: '', //其他需要特别说明的情况
        // casualtiesFeeLimits: '',//（1）每人伤亡责任限额（大写）
        // casualtiesFeeLimit: '',//（小写）
        // medicalFeeLimits: '',//（2）每人医疗费用责任限额（大写）
        // medicalFeeLimit: '',// （小写）
        // legalFeeLimits: '',//（3）法律费用责任限额（大写）
        // legalFeeLimit: '',// （小写）
        // liabilityLimits: '',//（4）累计责任限额（大写）
        // liabilityLimit: '',// （小写）
        // deductibles: '',//（5）每次事故每人医疗费用免赔额（大写）
        // deductible: '',// （小写）
        // insuranceRate: '',//（6）保险费率：
        insuranceTimeStart: '', // 16.保险期间：零时起
        insuranceTimeEnd: '',//二十四时止。
        sinsuranceFeeCounts: '',//17.总保险费（大写）
        sinsuranceFeeCount: '',//小写
        payTime: '',//18.保险费支付日期：
        solution: '1',//19.保险合同争议解决方式选择
        seal: '',//  投保人（签章）
        signingTime: '',//签章日期
        underwriting: '1',//承保性质
        agent: '',// 业务员/代理人姓名
        signPolicyholder: '',//   投保人（签章）
        signPolicyholderTime: '',//投保人（签章）日期
      },
      insuranceTimeStart1: '', // 16.保险期间：零时起
      insuranceTimeEnd1: '',//二十四时止。
      rules: {
        // employer1:{
        name1: [
          {required: true, message: '请输入投保人', trigger: 'blur'}
        ],
        contactPerson1: [
          {required: true, message: '请输入联系人姓名', trigger: 'blur'}
        ],
        phone1: [
          {required: true, message: '请输入联系人电话', trigger: 'blur'},
          {pattern: /^1[3|4|5|7|8][0-9]{9}$/, message: '请输入正确的联系人电话'}

        ],
        mailAddress1: [
          {required: true, message: '请输入投保人通讯地址', trigger: 'blur'},
          // {validator:validate('netmask','请输入正确的投保人通讯地址')}
        ],
        emailCode1: [
          {required: true, message: '请输入投保人邮编', trigger: 'blur'},
        ],
        email1: [
          {required: false, message: '请输入邮箱地址', trigger: 'blur'},
          {type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
        ],
        // },
        // employer2:{
        name2: [
          {required: true, message: '请输入被保险人', trigger: 'blur'}
        ],
        contactPerson2: [
          {required: true, message: '请输入联系人姓名', trigger: 'blur'}
        ],
        phone2: [
          {required: true, message: '请输入联系人电话', trigger: 'blur'},
          {pattern: /^1[3|4|5|7|8][0-9]{9}$/, message: '请输入正确的联系人电话'}
        ],
        mailAddress2: [
          {required: true, message: '请输入被保险人通讯地址', trigger: 'blur'},
          // {validator:validate('netmask','请输入正确的投保人通讯地址')}
        ],
        emailCode2: [
          {required: true, message: '请输入被保险人邮编', trigger: 'blur'},
        ],
        // commAddrAndPostcode2: [
        //   {required: false, message: '请输入投保人通讯地址和邮编', trigger: 'blur'}
        // ],
        email2: [
          {required: false, message: '请输入邮箱地址', trigger: 'blur'},
          {type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
        ],
        // },
        employerId2: [
          {required: true, message: '请选择用工单位', trigger: 'change'}
        ],
        // productDataId1: [
        //   {required: true, message: '请选择产品方案', trigger: 'change'}
        // ],
        insuranceTimeStart: [{
          required: true, message: '请选择起始日期', trigger: 'change'
        }],
        insuranceTimeEnd: [
          {
            required: true, message: '请选择结束日期', trigger: 'change'
          }
        ]

      },
      unit: new Array("仟", "佰", "拾", "", "仟", "佰", "拾", "", "角", "分"),
      Employer: [],//获取用工单位数据
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
        deptId: undefined
      },
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
        synopsis: null,
        type: null,
        status: null
      },
      //对应的工种
      typeOptions: [],
      //产品方案
      productOptions: [],
      props: {
        // multiple: true,
        // checkStrictly: true,
        // expandTrigger: 'hover',
        // emitPath:true,
        value: 'id',
        label: 'name',
        children: 'datas',

      },
      //字典回显
      typeOptions1: [],
      // 用工单位参数
      form: {},
      // 用工单位表单校验
      rules1: {
        name: [
          {required: true, message: "名称不能为空", trigger: "blur"}
        ],
        contact: [
          {required: true, message: "联系人不能为空", trigger: "blur"}
        ],
        phone: [
          {required: true, message: "电话不能为空", trigger: "blur"},
          {pattern: /^1[3|4|5|7|8][0-9]{9}$/, message: '请输入正确的联系人电话'}
        ],
        mailAddress: [
          {required: true, message: "通讯地址不能为空", trigger: "blur"}
        ],
        emailCode: [
          {required: true, message: "邮编不能为空", trigger: "blur"}
        ],
        email: [
          {required: false, message: '邮箱号码', trigger: 'blur'},
          {type: 'email', message: '请输入正确的邮箱号码', trigger: ['blur', 'change']}
        ],
        address: [
          {required: true, message: '保险人地址不能为空', trigger: 'blur'},
        ],
        businessScope: [
          {required: true, message: '保险人营业范围不能为空', trigger: 'blur'},
        ],
        industry: [
          {required: true, message: '所在行业不能为空', trigger: 'blur'},
        ],
        nature: [
          {required: true, message: '保险人性质不能为空', trigger: 'blur'},
        ],
        staffCount: [
          {required: true, message: '保险员工总数不能为空', trigger: 'blur'},
        ],
        seniorDescription: [
          {required: true, message: '高级职员姓名，职务，健康情况说明不能为空', trigger: 'blur'},
        ],
        generalDescription: [
          {required: true, message: '普通职员姓名，职务，健康情况说明不能为空', trigger: 'blur'},
        ],
        type: [
          {required: true, message: '用户类型不能为空', trigger: 'blur'},
        ]

      },
      typeOptions2: [],//用户类型
      // datas:[]//展示的数据
      ProductPlan:[],//方案
    }
  },
  mounted() {
    // 此处true需要加上，不加滚动事件可能绑定不成功
    window.addEventListener("scroll", this.handleScroll, true);
  },
  methods: {

    //选择添加投保类型
    gettemplate() {
      console.log('sfdgdh')
      this.$router.push({
        path: '/base/template/index'
      })
    },
    //清空当前数据
    resule() {
      this.formData = {
        customer_id:'',//用户id
        user_id:'',//操作人id
        // productDataId1: '',
        // productDataId: '',//产品方案id
        // templateId: [],//投保类型id
        employerId1: '',//投保用工单位id
        employerId2: '',//被投保用工单位
        name1: '', //  投保人姓名
        contactPerson1: '',//投保人联系人姓名
        phone1: '',  // 投保人联系电话
        mailAddress1: '', //投保人通讯地址
        emailCode1: '',//投保人邮编
        email1: '', //  投保人电子邮箱
        name2: '', //被投保人名称
        contactPerson2: '',//被投保人联系姓名
        phone2: '', //  被投保联系方式
        mailAddress2: '', //投保人通讯地址
        emailCode2: '',//投保人邮编
        email2: '',//  被投保电子邮箱
        nature2: '', //  3被投保人性质
        industry: '',  //  所在行业
        address2: '',  //  被保险人地址/营业场所
        businessScope2: '',  // 被保险人营业范围
        staffCount2: '',  // 被保险人工作人员总人数
        seniorDescription: '', //   其中高级职员姓名，职务，健康情况，请说明：
        generalDescription: '', // 其他类型工作人员说明（如工作类型、人数、健康情况）
        // 7. 过去三年是否投保过与雇主责任相关的保险？ {{isELI1}}是     {{isELI0}}否
        isELI: '0',//是
        //过去三年损失情况如何  {{isLossEli1}}有    {{isLossEli0}}无
        isLossEli: '0',//有
        // 如果有，请说明：保险期间        保险人数                损失情况                获赔情况
        eliDesc: '',
        // 是否按照《工伤保险条例》参加工伤保险？    {{isII1}}是    {{isII0}}否
        isII: '0',//是
        // 如果是，过去三年被保险人参加工伤保险的情况：保险期间  保险人数  损失情况  获赔情况
        iiDesc: '',
        // 工作人员上岗前，是否经过岗位培训？    {{isTrain1}}是    {{isTrain0}}否
        isTrain: '0',//是
        trainingTime: '',    // 培训时间一般多长？
        // 是否拥有专职医疗人员？  {{isHaveMedicalStaff1}}有 {{isHaveMedicalStaff0}}无
        isHaveMedicalStaff: '0',//有
        medicalStaffCount: '', // 如果有，请列明数量
        hospitalDistance: '',    //      与最近的医院的距离
        hospitalName: '', //请提供医院名称
        // 是否全部工作人员参加医疗保险？       {{isJoinMi1}}是   {{isJoinMi0}}否
        isJoinMi: '0',
        descriptionMi: '',// 如果否，请说明情况：
        compPrincipleAndLimit: '', //13. 赔偿原则及限额
        otherDescription: '', //其他需要特别说明的情况
        // casualtiesFeeLimits: '',//（1）每人伤亡责任限额（大写）
        // casualtiesFeeLimit: '',//（小写）
        // medicalFeeLimits: '',//（2）每人医疗费用责任限额（大写）
        // medicalFeeLimit: '',// （小写）
        // legalFeeLimits: '',//（3）法律费用责任限额（大写）
        // legalFeeLimit: '',// （小写）
        // liabilityLimits: '',//（4）累计责任限额（大写）
        // liabilityLimit: '',// （小写）
        // deductibles: '',//（5）每次事故每人医疗费用免赔额（大写）
        // deductible: '',// （小写）
        // insuranceRate: '',//（6）保险费率：
        insuranceTimeStart: '', // 16.保险期间：零时起
        insuranceTimeEnd: '',//二十四时止。
        sinsuranceFeeCounts: '',//17.总保险费（大写）
        sinsuranceFeeCount: '',//小写
        payTime: '',//18.保险费支付日期：
        solution: '1',//19.保险合同争议解决方式选择
        seal: '',//  投保人（签章）
        signingTime: '',//签章日期
        underwriting: '1',//承保性质
        agent: '',// 业务员/代理人姓名
        signPolicyholder: '',//   投保人（签章）
        signPolicyholderTime: '',//投保人（签章）日期
      }
    },
    //返回上一页
    getBack() {
      this.$router.back(-1);
    },
    //如果没有用工单位请选择用工单位
    getEmployers() {
      // console.log('dgdfhhgfg')
      this.reset();
      this.open = true;
      this.title = "添加用工单位";
      this.form.type = '2'
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sysUid: null,
        name: null,//名称
        contact: null,//联系人
        phone: null,//联系人电话
        mailAddress: null,//通讯地址
        emailCode: null,//邮编
        email: null,//邮箱号码
        delFlag: null,
        address: null,//被保险人地址
        businessScope: null,//被保险人营业范围
        generalDescription: null,//普通职员姓名，职务，健康情况说明
        industry: null,//所在行业
        nature: '3',//被保险人性质
        seniorDescription: '',//高级职员姓名，职务，健康说明
        staffCount: null,//被保险人总数
        type: null,
      };
      this.resetForm("form");
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /**用工单位 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          addEmployer(this.form).then(response => {
            this.msgSuccess("新增成功");
            this.open = false;
            this.getSelectEmployer();
            this.getList();
          });
        }
      });
    },
    //
    handleScroll() {
      let scrolltop = document.documentElement.scrollTop || document.body.scrollTop;
      // console.log('scrolltop',scrolltop)
      scrolltop > 30 ? (this.gotop = true) : (this.gotop = false);
    },
    //通过点击滚动回到顶部
    toTop() {

      let top = document.documentElement.scrollTop || document.body.scrollTop;
      // 实现滚动效果
      const timeTop = setInterval(() => {
        document.body.scrollTop = document.documentElement.scrollTop = top -= 50;
        if (top <= 0) {
          clearInterval(timeTop);
        }
      }, 10);
    },
    //选择用工单位
    getSelectEmployer() {
      listEmployer().then(res => {
        for (var i = 0; i < res.rows.length; i++) {
          if (res.rows[i].type == 2) {
            this.Employer.push(res.rows[i])
          }
        }
        var employers = res.rows;
        var employerObj = {}
        for (var i = 0; i < employers.length; i++) {
          if (employers[i].type == null) {
            this.$alert('请先去完善投保人信息', '标题名称', {
              confirmButtonText: '确定',
              callback: action => {
                this.open = true;
                this.title = "添加用工单位";
              }
            });
            this.form.type = '1';
          } else if (employers[i].type == null && employers[i].type == 2) {
            this.$alert('请先去完善投保人信息', '标题名称', {
              confirmButtonText: '确定',
              callback: action => {
                this.open = true;
                this.title = "添加用工单位";
              }
            });
            this.form.type = '1';
          } else if (employers[i].type == 1) {
            employerObj = employers[i]
          }
        }
        // console.log('employerObj',employerObj);
        this.formData.name1 = employerObj.name;
        this.formData.contactPerson1 = employerObj.contact;
        this.formData.phone1 = employerObj.phone;
        this.formData.email1 = employerObj.email;
        this.formData.mailAddress1 = employerObj.mailAddress;
        this.formData.emailCode1 = employerObj.emailCode;
        this.formData.employerId1 = employerObj.id;

        console.log('Employer',this.Employer)
        console.log('res用工单位',res)
      })
    },

    //产品方案选择
    handleChange(value) {
      console.log('产品方案', value)
      var productDataId = ''
      for (var i = 0; i < value.length; i++) {
        productDataId = value[1]
        // console.log('aa',value[1])
      }
      // var a=value[0][1]
      console.log('a', productDataId)


      this.formData.productDataId = productDataId
      //  console.log('productDataId', this.formData)
      var id = value;
      this.proShow = true;
      var datas = {};
      listProductType(this.queryParams1).then(response => {
        console.log('产品方案12', response)
        // var a1='';
        //  var a2='';
        //  var b1='';
        //  var b2='';
        // for (var i=0;i<id.length;i++){
        //   b1=id[i][0];
        //   b2=id[i][1];
        // }
        // console.log('b1',b1);
        // console.log('b2',b2);
        for (var i = 0; i < response.rows.length; i++) {
          for (var j = 0; j < response.rows[i].datas.length; j++) {

            // a1=response.rows[i].id;
            // a2=response.rows[i].datas[j].id;
            // console.log('a1',a1);
            // console.log('a2',a2);
            if (response.rows[i].id == id[0] && response.rows[i].datas[j].id == id[1]) {
              datas = response.rows[i].datas[j];
              // console.log('objdatas',response.rows[i].datas[j]);
            }
            // if (response.rows[i].id == b1 && response.rows[i].datas[j].id == b2) {
            //   // console.log('sasfsdfdg',response.rows[i])
            //
            //  this.datas.push(response.rows[i].datas[j])
            //   // console.log('objdatas',response.rows[i].datas[j]);
            // }
          }
        }
        // console.log('datas',this.datas)


        this.formData.casualtiesFeeLimit = datas.casualties
        this.formData.medicalFeeLimit = datas.medical;
        this.formData.legalFeeLimit = datas.legal;
        this.formData.liabilityLimit = datas.liability;
        this.formData.deductible = datas.deductibles;
        this.formData.insuranceRate = datas.insuranceRate
        // console.log('objdatas',datas);
        if (this.formData.casualtiesFeeLimit != null) {
          this.perProfits();
        }
        if (this.formData.medicalFeeLimit != null) {
          this.perProfits1();
        }
        if (this.formData.legalFeeLimit != null) {
          this.perProfits2();
        }
        if (this.formData.liabilityLimit != null) {
          this.perProfits3();
        }
        if (this.formData.deductible != null) {
          this.perProfits4()
        }
      })

    },
    perProfits() {

      //输入金额时，限制小数后两位正则表达式
      var that = this;

      if (!this.formData.casualtiesFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.casualtiesFeeLimit = '';
        return
      }
      if (this.formData.casualtiesFeeLimit !== '') {

        var m = this.formData.casualtiesFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.casualtiesFeeLimits = result;
        if (this.formData.casualtiesFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits1() {
      if (!this.formData.medicalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.medicalFeeLimit = '';
        return
      }
      if (this.formData.medicalFeeLimit !== '') {

        var m = this.formData.medicalFeeLimit
        m *= 100;
        m += "";
        console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.medicalFeeLimits = result;
        if (this.formData.medicalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits2() {
      if (!this.formData.legalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.legalFeeLimit = '';
        return
      }
      if (this.formData.legalFeeLimit !== '') {

        var m = this.formData.legalFeeLimit
        m *= 100;
        m += "";
        console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.legalFeeLimits = result;
        if (this.formData.legalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits3() {
      if (!this.formData.liabilityLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.liabilityLimit = '';
        return
      }
      if (this.formData.liabilityLimit !== '') {

        var m = this.formData.liabilityLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.liabilityLimits = result;
        if (this.formData.liabilityLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfits4() {
      if (!this.formData.deductible) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.deductible = '';
        return
      }
      if (this.formData.deductible !== '') {

        var m = this.formData.deductible
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.deductibles = result;
        if (this.formData.deductible < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    //当没有产品方案选择
    handleChanges() {
      this.$router.push({
        path: '/product/productType/index'
      })
    },
    //获取产品方案
    getListProductType() {
      listProductType(this.queryParams1).then(response => {
        console.log('产品方案', response)
        this.productOptions = [];
        this.productOptions = response.rows;
        this.productOptions.forEach(v => {
          v.name = this.selectDictLabel(this.typeOptions1, v.type);
        })

        console.log('产品方案productOptions', this.productOptions)
      })
    },

    //选择用工单位
    getEmployer(item) {
      this.formData.name2 = item.name;
      this.formData.contactPerson2 = item.contact;
      this.formData.phone2 = item.phone;
      this.formData.email2 = item.email;
      this.formData.nature2 = item.nature;
      this.formData.industry = item.industry;
      this.formData.address2 = item.address;
      this.formData.businessScope2 = item.businessScope;
      // this.formData.staffCount2 = item.staffCount;
      this.formData.seniorDescription = item.seniorDescription;
      this.formData.generalDescription = item.generalDescription;
      this.formData.mailAddress2 = item.mailAddress;
      this.formData.emailCode2 = item.emailCode;
      //   console.log('formData',this.formData);
      // console.log('item',item);
    },

    getSelect(item, index) {

      // this.formData.templateId = item.id;
      // for (var i=0;i<this.templateName.length;i++){
      //   if (this.templateName[i]==1){
      //     this.isActive=this.templateName[i]
      //   }
      //   if (this.templateName[i]==2){
      //     this.isActive1=this.templateName[i]
      //   }
      //   if (this.templateName[i]==3){
      //     this.isActive2=this.templateName[i]
      //   }
      //   if (this.templateName[i]==4){
      //     this.isActive3=this.templateName[i]
      //   }
      //
      // }
      // this.isActive=index;
      // console.log('item',item);
      // console.log('index',index);
      // console.log('templateName', this.templateName)
      // console.log('isActive', this.isActive)
      // console.log('isActive1', this.isActive1)
      // console.log('isActive2', this.isActive2)
      // console.log('isActive3', this.isActive3)
    },
    //香烟则被投保人性质
    getDate(e) {
      // console.log('e', e)
      // console.log('formData', this.formData);
    },

    //选择投保单类型
    getQuer() {
      // listTemplate().then(response => {
      //   this.options = response.rows;
      //   this.formData.templateId.push(this.options[0].id);
      //   this.templateName.push(this.options[0].id);
      //
      //   console.log('templateId', this.templateName)
      //   console.log('responsewewew', response)
      // })
    },

    toDx(n) {   //阿拉伯数字转换函数
      switch (n) {
        case "0":
          return "零";
        case "1":
          return "壹";
        case "2":
          return "贰";
        case "3":
          return "叁";
        case "4":
          return "肆";
        case "5":
          return "伍";
        case "6":
          return "陆";
        case "7":
          return "柒";
        case "8":
          return "捌";
        case "9":
          return "玖";
      }
    },
    perProfit(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      // console.log('e金额',e)
      this.formData.casualtiesFeeLimit = e;

      if (!this.formData.casualtiesFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.casualtiesFeeLimit = '';
        return
      }
      if (this.formData.casualtiesFeeLimit !== '') {

        var m = this.formData.casualtiesFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.casualtiesFeeLimits = result;
        if (this.formData.casualtiesFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit1(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.medicalFeeLimit = e;
      if (!this.formData.medicalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.medicalFeeLimit = '';
        return
      }
      if (this.formData.medicalFeeLimit !== '') {

        var m = this.formData.medicalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.medicalFeeLimits = result;
        if (this.formData.medicalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit2(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.legalFeeLimit = e;
      if (!this.formData.legalFeeLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.legalFeeLimit = '';
        return
      }
      if (this.formData.legalFeeLimit !== '') {

        var m = this.formData.legalFeeLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.legalFeeLimits = result;
        if (this.formData.legalFeeLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit3(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.liabilityLimit = e;
      if (!this.formData.liabilityLimit) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.liabilityLimit = '';
        return
      }
      if (this.formData.liabilityLimit !== '') {

        var m = this.formData.liabilityLimit
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.liabilityLimits = result;
        if (this.formData.liabilityLimit < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit4(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.deductible = e;
      if (!this.formData.deductible) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.deductible = '';
        return
      }
      if (this.formData.deductible !== '') {

        var m = this.formData.deductible
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.deductibles = result;
        if (this.formData.deductible < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
    perProfit5(e) {
      // console.log('e', e)
      //输入金额时，限制小数后两位正则表达式
      var that = this;
      e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
      this.formData.sinsuranceFeeCount = e;
      if (!this.formData.sinsuranceFeeCount) {
        this.$Message.error('请输入正确的投资金额');
        this.formData.sinsuranceFeeCount = '';
        return
      }
      if (this.formData.sinsuranceFeeCount !== '') {

        var m = this.formData.sinsuranceFeeCount
        m *= 100;
        m += "";
        // console.log('m', m)
        var length = m.length;
        var result = "";
        for (var i = 0; i < length; i++) {
          if (i == 2) {
            result = "元" + result;
          } else if (i == 6) {
            result = "万" + result;
          }
          if (m.charAt(length - i - 1) == 0) {
            if (i != 0 && i != 1) {
              if (result.charAt(0) != '零' && result.charAt(0) != '元' && result.charAt(0) != '万') {
                result = "零" + result;
              }
            }
            continue;
          }
          result = this.toDx(m.charAt(length - i - 1)) + this.unit[this.unit.length - i - 1] + result;
        }
        result += result.charAt(result.length - 1) == '元' ? "整" : "";
        this.formData.sinsuranceFeeCounts = result;
        if (this.formData.sinsuranceFeeCount < 1
        ) {
          this.$Message.error('投资金额必须大于1元');
          return
        }
        // if (this.formData.casualtiesFeeLimit > this.table.remainMoney) {
        //   this.$Message.error('不能超过可投金额');
        //   this.formData.casualtiesFeeLimit = '';
        //   return
        // }
      }
    },
//点击提交按钮提交数据
    getAdd(formData) {

      console.log('formData', this.formData);
      this.$refs[formData].validate((valid) => {
        if (valid) {
          addInsureEli1(this.formData).then(res => {
            console.log('res添加保单', res);
            if (res.code==1){
              this.$message({
                showClose: true,
                message: res.msg,
                type: 'success'
              });
              setTimeout(()=>{
                this.$router.push({
                  path: '/insurancemanagement/ListApplication'
                })
              },500)
            }
          })
        } else {
          if (this.formData.name1 == '') {
            this.$message({
              showClose: true,
              message: '投保人姓名不能为空',
              type: 'error'
            });
            this.$refs['name1'].focus();
          } else if (this.formData.contactPerson1 == '') {
            this.$message({
              showClose: true,
              message: '投保联系人姓名不能为空',
              type: 'error'
            });
            this.$refs['contactPerson1'].focus();
          } else if (this.formData.phone1 == '') {
            this.$message({
              showClose: true,
              message: '投保联系人电话不能为空',
              type: 'error'
            });
            this.$refs['phone1'].focus();
          } else if (this.form.mailAddress1 == '') {
            this.$message({
              showClose: true,
              message: '投保人通讯地址不能为空',
              type: 'error'
            });
            this.$refs['mailAddress1'].focus();
          } else if (this.form.emailCode1 == '') {
            this.$message({
              showClose: true,
              message: '投保人邮编不能为空',
              type: 'error'
            });
            this.$refs['emailCode1'].focus();
          }
              // else if(this.formData.email1==''){
              //   this.$message({
              //     showClose: true,
              //     message: '投保人电子邮件不能为空',
              //     type: 'error'
              //   });
              //   this.$refs['email1'].focus();
          // }
          else if (this.formData.employerId2 == '') {
            this.$message({
              showClose: true,
              message: '请选择用工单位',
              type: 'error'
            });
            this.$refs['EmployerId'].focus();
          } else if (this.formData.name2 == '') {
            this.$message({
              showClose: true,
              message: '被保险人姓名不能为空',
              type: 'error'
            });
            this.$refs['name2'].focus();
          } else if (this.formData.contactPerson2 == '') {
            this.$message({
              showClose: true,
              message: '被保险人联系人姓名不能为空',
              type: 'error'
            });
            this.$refs['contactPerson2'].focus();
          } else if (this.formData.phone2 == '') {
            this.$message({
              showClose: true,
              message: '被保险人联系人电话不能为空',
              type: 'error'
            });
            this.$refs['phone2'].focus();
          } else if (this.form.mailAddress2 == '') {
            this.$message({
              showClose: true,
              message: '被保险人通讯地址不能为空',
              type: 'error'
            });
            this.$refs['mailAddress2'].focus();
          } else if (this.form.emailCode2 == '') {
            this.$message({
              showClose: true,
              message: '被保险人邮编不能为空',
              type: 'error'
            });
            this.$refs['emailCode2'].focus();
          } else if(this.formData.insuranceTimeStart==''){
            this.$message({
              showClose: true,
              message: '请选择起始日期',
              type: 'error'
            });
            this.$refs['insuranceTimeStart'].focus();
          } else if(this.formData.insuranceTimeEnd=='') {
            this.$message({
              showClose: true,
              message: '请选择结束日期',
              type: 'error'
            });
            this.$refs['insuranceTimeEnd'].focus();
          }
              // else if(this.formData.email2==''){
              //   this.$message({
              //     showClose: true,
              //     message: '被保险人电子邮件不能为空',
              //     type: 'error'
              //   });
              //   this.$refs['email2'].focus();
          // }
          // else if (this.formData.productDataId == '') {
          //   var that = this
          //   this.$message({
          //     showClose: true,
          //     message: '请选择产品方案',
          //     type: 'error'
          //   });
          //   let error = document.getElementsByClassName("el-error");
          //   error[0].querySelector("input").focus();

            // console.log('选择产品方案df', this.$refs['productId'].focus())

          // }

          //
          // }
          return false
        }
      })
    },
    //将所有数据清空
    // resetForm(formData){
    // this.$refs[formData].resetFields();
    // }
    getList() {
      this.loading = true;
      getUserProfile().then(response => {
            // this.userList = response.rows;
            var employers = response.data.employers;
            console.log('employers24', response)
            // var employerObj = {}
            // for (var i = 0; i < employers.length; i++) {
            //   if (employers[i].type == null) {
            //     this.$alert('请先去完善投保人信息', '标题名称', {
            //       confirmButtonText: '确定',
            //       callback: action => {
            //         this.open = true;
            //         this.title = "添加用工单位";
            //       }
            //     });
            //     this.form.type = '1';
            //   } else if (employers[i].type == null && employers[i].type == 2) {
            //     this.$alert('请先去完善投保人信息', '标题名称', {
            //       confirmButtonText: '确定',
            //       callback: action => {
            //         this.open = true;
            //         this.title = "添加用工单位";
            //       }
            //     });
            //     this.form.type = '1';
            //   } else if (employers[i].type == 1) {
            //     employerObj = employers[i]
            //   }
            // }
            if (response.data.seal == null) {
              this.$alert('请先去上传公章', '标题名称', {
                confirmButtonText: '确定',
                callback: action => {
                  this.$router.push({
                    path: '/user/profile'
                  })
                }
              });
            }
            // console.log('employerObj',employerObj);
            // this.formData.name1 = employerObj.name;
            // this.formData.contactPerson1 = employerObj.contact;
            // this.formData.phone1 = employerObj.phone;
            // this.formData.email1 = employerObj.email;
            // this.formData.mailAddress1 = employerObj.mailAddress;
            // this.formData.emailCode1 = employerObj.emailCode;
            // this.formData.employerId1 = employerObj.id;
            this.formData.seal = response.data.seal
            this.formData.signPolicyholder = response.data.seal

            // console.log('response12',response);
          }
      );
    },
    //计算当前月份的
    getTime() {
      //当前月份的第一天
      var date = new Date();
      date.setDate(1);
      var month = parseInt(date.getMonth() + 1);
      var day = date.getDate();
      if (month < 10) {
        month = '0' + month
      }
      if (day < 10) {
        day = '0' + day
      }
      var time = date.getFullYear() + '-' + month + '-' + day;
      this.insuranceTimeStart1 = date.getFullYear() + ' 年 ' + month + ' 月 ' + day;
      //转时间戳
      // var data2 = new Date(time);
      // this.formData.insuranceTimeStart = data2.getTime();
      this.formData.insuranceTimeStart =time;
      //  当前月份的最后一天
      var date1 = new Date();

      var currentMonth = date1.getMonth();

      var nextMonth = ++currentMonth;
      var nextMonthFirstDay = new Date(date1.getFullYear(), nextMonth, 1);
      var oneDay = 1000 * 60 * 60 * 24;
      var lastTime = new Date(nextMonthFirstDay - oneDay);
      var month1 = parseInt(lastTime.getMonth() + 1);
      var day1 = lastTime.getDate();
      if (month1 < 10) {
        month1 = '0' + month1
      }
      if (day1 < 10) {
        day1 = '0' + day1
      }
      var time1 = date1.getFullYear() + '-' + month1 + '-' + day1;
      this.insuranceTimeEnd1 = date1.getFullYear() + ' 年 ' + month1 + ' 月 ' + day1;
      // var data3 = new Date(time1);
      // this.formData.insuranceTimeEnd = data3.getTime();
      this.formData.insuranceTimeEnd =time1;
      console.log('insuranceTimeEnd', this.formData.insuranceTimeEnd)
      console.log('insuranceTimeStart', this.formData.insuranceTimeStart)
      console.log('insuranceTimeEnd', this.formData)

    },
  },


  created() {
    //调用清空当前数据函数
    this.resule();
    // this.getTime();
    //查询投保类型
    this.getQuer();
    //查询用工单位
    this.getSelectEmployer();
    this.formData.user_id = JSON.parse(localStorage.getItem('userInfo')).userId;
    var programme = this.$route.query.programme;
    if (programme != undefined) {
      this.formData.customer_id = programme.customer_id;
      this.ProductPlan = programme.list;
      this.formData.staffCount2=programme.count;
      console.log('programme', programme);
      console.log('customer_id',  this.formData.customer_id )
    }
    this.getDicts("industry_type").then(response => {
      this.typeOptions1 = response.data;
      console.log('typeOptions1', this.typeOptions1)
    });
    this.getDicts("industry_type").then(response => {
      this.typeOptions = response.data;
    });
    this.getDicts("employer_type").then(response => {
      this.typeOptions2 = response.data;
    });
    //调用产品方案数据
    this.getListProductType();
    //管理员信息
    this.getList();
    this.getDicts("insure_nature").then(response => {
      this.statusOptions = response.data;
    });
    this.getDicts("insure_take").then(response => {
      this.statusOptions1 = response.data;
    });
    this.getDicts("insure_situation").then(response => {
      this.statusOptions2 = response.data;
      console.log('statusOptions2', this.statusOptions2)
    });
    this.getDicts("insure_contract").then(response => {
      this.statusOptions3 = response.data;
    });
    this.getDicts("insure_underwriting").then(response => {
      this.statusOptions4 = response.data;
    });
    console.log('isELI', this.formData);
  }
}
</script>

<style scoped lang="scss">
.insureEli_conter {
  //background: #00afff;
  overflow: hidden;

  .footer {
    position: fixed;
    right: 50px;
    bottom: 80px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    //background-color: #00afff;
  }

  .row_top {
    //background: #00afff;
    margin: 20px auto;

    .top_img {
      //background: pink;

      img {
        margin-left: 100px;
        //width: 500px;
      }
    }

    .grid-content {

      //background: #00afff;
      height: 62px;
      line-height: 62px;
      text-align: right;
      margin-right: 10px;
      min-width: 300px;
      max-width: 400px;

      span {
        margin-right: 5px;
      }
    }
  }


  .title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;

    span {
      font-size: 16px;
      font-weight: normal;
      margin-left: 20px;
    }
  }

  .explain {
    text-indent: 2em;
    font-size: 14px;
    margin: 10px;

    span {
      font-weight: bold;
    }
  }

  .tem_from {
    //background: pink;
    padding: 20px;

    .infor {
      margin-top: 20px;
      //background: #4AB7BD;
      min-width: 500px;
      min-width: 100%;
      display: flex;
      flex-flow: wrap;
      align-items: center;
      //justify-content: space-between;

      .el-input {
        width: 200px;
        //background: #00afff;
      }

      .el-input1 {
        width: 250px;
      }
    }

    .infor1 {
      margin-top: 20px;
      padding-left: 20px;
    }

    .infor1_Industry {
      display: flex;
      flex-direction: column;
      //background-color: pink;
      margin: 20px 20px 20px 40px;
      //align-items: center;

      span {
        display: inline-block;
        width: 150px;
        margin-bottom: 20px;
        //background-color: pink;

        //background-color: #00afff;
      }

    }

    .infor2 {
      display: flex;
      //background-color: pink;
      margin: 20px auto;
      align-items: center;

      span {
        display: inline-block;
        width: 240px;
        //background-color: #00afff;
      }

      .input {
        width: 80px;
        margin-right: 5px;
      }
    }

    .infor3 {
      //background-color: #4AB7BD;
      flex-direction: column;
      align-items: normal;
      box-sizing: border-box;
      padding-right: 40px;

      span {
        margin-bottom: 20px;
      }

    }

    .el-row {
      margin-bottom: 20px;
      margin: 0 20px 20px;
      display: flex;
      align-items: center;

      .input1 {
        margin-left: 20px;
      }
    }

    .grid-content {
      margin-left: 20px;
      //background-color: pink;
      //height: 35px;
      //line-height: 35px;
    }

    .grid-content2 {
      font-weight: bold;
      text-align: center;
    }

    .bg-purple {
      font-weight: bold;
    }

    .conter {
      background-color: #f1f1f1;
      border-radius: 6px;
      padding: 20px;
      margin-bottom: 20px;
    }
  }

  .yinying {
    background-color: rgba(0, 0, 0, .4);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}
</style>
